/*
 *   This File is Part of CuteOgre Game Engine
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *	Copyright 2010 Alexandre Pires ( c.alexandre.pires@gmail.com )
 *  Created on: 2010/08/22
 */

#ifndef GUIMANAGER_H_
#define GUIMANAGER_H_

#include "IManager.h"
#include "Singleton.h"
#include <QMap>

class Layout;
class StyleSheetManager;

class GUIManager :
		public IManager,
		public Singleton<GUIManager> {

typedef QMap<QString, Layout*> LayoutMap;

friend class GameEngine;

private:
	bool mShutdown;
	StyleSheetManager* mStyleSheetManager;
	LayoutMap mLayouts;

protected:
	GUIManager () : mShutdown(true) {
	}

public:
	~GUIManager () {

	}

	static GUIManager* getSingletonPtr(void) {
		return ms_Singleton;
	}

	static GUIManager& getSingleton(void) {
		assert( ms_Singleton );  return ( *ms_Singleton );
	}

	void init ();
	void shutdown ();

	void loadLayout ( const QString& rName );
	void unloadLayout ( const QString& rName );
	Layout* getLayout ( const QString& rName );

	inline static void load ( const QString& rName ) {
		GUIManager::getSingleton().loadLayout(rName);
	}

	inline static void unload ( const QString& rName ) {
		GUIManager::getSingleton().unloadLayout(rName);
	}

	inline static Layout* layout ( const QString& rName ) {
		return GUIManager::getSingleton().getLayout( rName );

	}
};

#endif /* GUIMANAGER_H_ */
